﻿
#region Usings

using PolyGameEngine.GamePieces.Common;
using PolyGameEngine.Tools;

using FarseerPhysics.Dynamics;
using FarseerPhysics.Factories;

using Microsoft.Xna.Framework;

#endregion

namespace PolyGameEngine.GamePieces
{
    public class Tile : GamePiece
    {
        #region Constructors
        public Tile(PhysicsGame PhysicsGame, World World, Material Material, Vector2 Position, float Rotation, int Width, int Height, float DrawingDepth, int saveLineIndex, string GPID)
            : base(PhysicsGame, World, Material, Position,Rotation, DrawingDepth,saveLineIndex, GPID)
        {
            FixtureFactory.AttachRectangle(ConvertToSim(Width), ConvertToSim(Height), 1, Vector2.Zero, body);
            bodyType = BodyType.Static;
            friction = Material.Friction;
            restitution = Material.Restitution;
            defaultFixture.OnCollision += HandleDefaultCollision;
            defaultFixture.OnSeparation += HandleDefaultAfterCollision;
        }
        public Tile(PhysicsGame PhysicsGame, World World, Material Material, Vector2 Position, float Rotation, int saveLineIndex, string GPID)
            : this(PhysicsGame, World, Material, Position,Rotation, 50, 50, 0, saveLineIndex, GPID) { }
        public Tile(PhysicsGame PhysicsGame, World World, Material Material,int saveLineIndex, string GPID)
            : this(PhysicsGame, World, Material, Vector2.Zero,0, 50, 50, 0, saveLineIndex,  GPID) { }
        #endregion
    }
}
